{
  "properties" : { },
  "id" : "copy1710491154715d90969",
  "script" : null,
  "groupId" : "87746fd906e04f488032f0a4a45f1c06",
  "name" : "登录",
  "createTime" : 1714063372566,
  "updateTime" : 1710646103111,
  "lock" : null,
  "createBy" : "管理员",
  "updateBy" : "管理员",
  "path" : "login",
  "method" : "POST",
  "parameters" : [ {
    "name" : "account",
    "value" : "admin",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "password",
    "value" : "123456",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "{}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 401,\n    \"msg\": \"账号信息不匹配\",\n    \"data\": {\n        \"token\": \"RVZmNXZvKzhqRVR1aUlLMXhGYURXZz09\"\n    }\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import 'com.wiwf.model.security.service.SysUserService' as sysUserService;
import 'com.wiwf.model.security.service.SysTokenService' as sysTokenService;

if(account == null) {
    if(body.account == null) {
        return null;
    }
    account = body.account;
    password = body.password;
}

if(sysTokenService.getToken()){
    sysTokenService.delTokenUser();
}

var user = sysUserService.getUser(account,password);
if(user == null) {
    exit 401,"账号信息不匹配";
}
if(user.getIsEnabled() == 0){
    exit 401,"账号未启用";
}
if(user.getNonLock() == 0){
    exit 401,"账号被锁定";
}
if(user.getNonExpired() == 0){
    exit 401,"账号过期";
}
if(user.getNonExpiredC() == 0){
    exit 401,"账号凭证过期";
}

exit 200,"认证通过",user;